coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using coreutils nohup in Windows


From: Bob Proulx
Subject: Re: Using coreutils nohup in Windows
Date: Sun, 24 May 2020 17:27:45 -0600

Keith Neargarder wrote:
> I am trying to execute a Perl script using nohup but I get the
> error:nohup: cannot run command 'test.pl': Exec format error

Your operating system apparently does not understand #! scripts.

I can see that you are running MS-Windows.  Obviously the GNU Project
is dedicated to free software and that is what most of us are
running.  Which is likely why no one responded earlier.  Sorry.  No
one had anything to say.  Don't know anything about it.

> Command I am trying to run is:nohup test.pl > test.log 2>&1 &
> I have figured out that it will run if I put "perl" before my script:
> nohup perl test.pl > test.log 2>&1 &

In this case the nohup command is running perl.  And perl is found as
perl.exe as you described.  You OS knows how to start .exe files and
does so.  Then test.pl is a program argument to perl.exe.  perl.exe
then reads, interprets, executes, the program test.pl.

> My perl.exe is located at c:\Perl\bin\perl.exe
> I have .pl files associated to the perl.exe and can run Perl scripts
> at the command prompt simply by typing in the script name without
> the "perl" command prefix.

I am sorry but I know very little about what Microsoft does here.  My
expectation is that the OS will stat(2) the file looking to see if the
execute bit is set or not.  If it is set then the OS will try to
exec(2) the file.  On scripts this will fail (internally to the kernel
now) since it is not machine code and then will read the first few bytes
the file looking for a #!/path/to/interpreter/program and if found
then it starts the program and the program reads the file.

I have no idea how Microsoft handles this type of thing.  I rather
expect it will need a test.bat wrapper to be executed which will turn
around and call perl on it.  I have no idea.

> I have also tried the shebang at the top of my test.pl script (with
> forward and backward slashes):#!\Perl\bin\perl
> No matter what I try nohup doesn't want to execute the Perl script
> unless I prefix it with the call to the "perl" executable.
> I would really like to avoid that if possible. Why doesn't the file
> association work with nohup?

No idea.  Sorry.

However for anyone else to know anything they would need to know what
port of the utilities you are using.  And the version of them.  Is
this Cygwin?  Or MinGW?  Or any of many other possibilities.  I am
guessing that it is not Cygwin because you say it is not working and I
feel confident that it would work.

  nohup --version

If you say the environment on Windows that you are using and the
version then it is possible that someone else might know something
about it.

I think it likely that if you installed Cygwin that things would Just Work.

Good Luck!
Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]