Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Executing command line script in Eclipse or as Win32::Daemon does not work

by bulk88 (Priest)
on Jul 27, 2012 at 16:40 UTC ( [id://984051]=note: print w/replies, xml ) Need Help??


in reply to Executing command line script in Eclipse or as Win32::Daemon does not work

You forgot a semicolon.

Have you tried doing
my $cmd = q("dir"); open FH, "$cmd |" or die "Couldn't execute $cmd: $!\n"; while(defined(my $line = <FH>)) { chomp($line); print "$line\n"; } close FH;
in the debugger and as a service?
  • Comment on Re: Executing command line script in Eclipse or as Win32::Daemon does not work
  • Download Code

Replies are listed 'Best First'.
Re^2: Executing command line script in Eclipse or as Win32::Daemon does not work
by Anonymous Monk on Jul 30, 2012 at 08:54 UTC

    Sorry I have slightly altered the code and forgot the write the semicolon, it was there in the original when called before.

    I had already run it in the debugger, but now I tried it as a service as well: In a debugger, it works. But now as a service even my small test script doesn't work.

    So to summarize: My program does not work in the debugger or as a service, but as a command line (everything with administrator privileges). My small test script does work from command line and in the debugger but not as a service. The error they report is always the same (53). It seems I now have two (possibly related) errors: One not allowing me to run the program as a service and one in my program which stops me from executing it anywhere but a command prompt. How do I go on from here?

      Rather than running sscep.exe, have you tried running a shell command like dir to prove you have a shell available in debugger or service? or tried running something like "perl -e" print 'hello world'" in debugger or service to prove you can run exes at all?

      Your app, sscep.exe, might be multithreaded, and has a watchdog thread on it console writing thread, if you run it in a debugger, and sscep notices console writes are taking too long (because perl isn't collecting the lines since its frozen in a debugger), sscep can abort with random errors. When running as a service, as BrowserUK said, permissions. I'm not sure what happens if a service tries to draw a GUI from its service/local system account. Also stop using double quotes for your paths in Perl. You run the risk (how much I'm not sure) of creating control characters with those escapes, which can lead to your error 53 bad path.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://984051]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-04-19 23:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found