Giter VIP home page Giter VIP logo

Comments (6)

alphacabbage1 avatar alphacabbage1 commented on August 20, 2024

I don't know much about system() and the dividing line between commands/parameters, shell substitution/escapes, etc but suspect it wont be considered a bug. This works under WIn10...

my $cmd=qq("python --version && python -h && perl -v");
print("Command => $cmd\n");
system($cmd);

Command => "python --version && python -h && perl -v"
Python 3.9.4
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
[...]
This is perl 5, version 32, subversion 1 (v5.32.1) built for MSWin32-x64-multi-thread
[...]

from perl-dist-strawberry.

thombet avatar thombet commented on August 20, 2024

Thanks for the fast reply.

Maybe it is not a bug in perl itself but I think there is a problem somewhere: it is quite disturbing that this code runs differently on Strawberry Perl compared to other perl versions (including on the same OS with Git Bash). Especially since Strawberry Perl is designed to be as close as possible to perl environment on UNIX systems..
What do you think?

from perl-dist-strawberry.

shawnlaffan avatar shawnlaffan commented on August 20, 2024

This is likely a generic issue with how system calls are run under windows.

The Strawberry perl environment is close to unix in how it is built and some of the tools provided, but still runs as a Windows program. Any system call will use the windows shell, not a unix shell (although I think some system calls sidestep the shell).

Git bash is a cut-down version of MSYS (or a similar environment) so is essentially a unix environment. That would be why it behaves as expected.

What happens when you run the script using a non-Strawberry perl on native Windows?

from perl-dist-strawberry.

thombet avatar thombet commented on August 20, 2024

Thanks for reviving this topic @shawnlaffan 😃

I tried to run the following code

my $cmd="python --version && python -h";
print("Command => $cmd\n");
system($cmd);

with ActiveState perl 5.36.0 on Windows 10 and here is the output:

Command => python --version && python -h

➡️ None of the python commands are run so the behaviour is wrong (or at least not expected) and different than Strawberry perl (I was not able to try the same code with a recent version of Strawberry perl because the website https://strawberryperl.com/ is currently down...).

from perl-dist-strawberry.

shawnlaffan avatar shawnlaffan commented on August 20, 2024

Thanks for trying with AS Perl. This would seem to be a more generic issue than Strawberry Perl.

It's probably worth following up with sites like perlmonks, stackoverflow or reddit.

And out of curiosity, do you get the same issue when running under powershell? (This will need manual path updates as we don't yet have a powershell version of portableshell.bat - see #52).

Once I get a strawberry 5.36 build working I'll also have a go with that.

from perl-dist-strawberry.

shawnlaffan avatar shawnlaffan commented on August 20, 2024

Testing under 5.36 shows the same behaviour.

Given the issue is more generic than Strawberry Perl it is best raised on a more general channel, and perhaps as a perl issue.

I'll close this issue in a few days unless there are good reasons to keep it open.

from perl-dist-strawberry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.