Page 1 of 1

Powershell not exiting when called by SAB

Posted: March 7th, 2010, 3:51 am
by Mills
I use some postprocessing powershell scripts (called by a bat file), and when they are called by SABnzbd in postprocessing they never exit. If I grab the commandline being executed with process explorer, and paste it into cmd, it runs perfectly fine.

The little output log added (thank you devs!) when I kill the script just shows up to the powershell execution and nothing afterward. Even if I modify the powershell script to just run dir, it will still hang. The strange thing is this worked just fine on my Windows 7 computer. Not sure how to debug this. Would appreciate any help.

Version: 0.5.0
OS: Windows Server 2008 R2 Standard

EDIT: This seems to be a common problem with powershell in general when being called by other programs. /EDIT
EDIT2: Screw Powershell I just rewrote everything in C#. /EDIT2

Thanks,

Mills

Re: Powershell not exiting when called by SAB

Posted: March 7th, 2010, 3:09 pm
by shypike
Yeah, somehow MS had to screw up.
You didn't think they'd make a really usable scripting language, now did you?  ;D

Re: Powershell not exiting when called by SAB

Posted: March 7th, 2010, 6:57 pm
by mikeyj
I'm having a similar problem with Robocopy.  The first time this code runs it's fine but it never exits and any item in the queue that follows will not process.

Code: Select all

robocopy M:\!Processing\_tv\ M:\!Processing\_tvfinished\ /E /XD _* /MOV /MON:1 /MOT:1
Any thoughts?
Thx,
Mike

Re: Powershell not exiting when called by SAB

Posted: March 8th, 2010, 2:58 am
by shypike
Of course it doesn't exit.
The /MON and /MOT parameters will make it run forever.
You cannot use those in a script.
See:
http://www.stevelu.com/TechnicalArticle ... /1206.aspx