delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/10/15/15:23:21

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
content-class: urn:content-classes:message
Subject: Perl system() and Cygwin
MIME-Version: 1.0
Date: Tue, 15 Oct 2002 15:23:10 -0400
Message-ID: <7BFCE5F1EF28D64198522688F5449D5AD63A40@xchangeserver2.storigen.com>
X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: "Scott Prive" <Scott DOT Prive AT storigen DOT com>
To: "Cygwin" <cygwin AT cygwin DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id g9FJNKF10081

Hello,

I'm experiencing some non-intuitive behavior when -- under Cygwin Perl -- calling system commands. The FAQ alludes to "differences" between Cygwin and systems like Linux.. this might be another one of these differences, or it might be dumb-user-error.

I have a solution I can live with. I just don't like not knowing what breaks my other attempts.

I want to do the Perl equivalent of 
net use Q: \\\\e04-3000\\foo foo /user:foo

This always works in bash, running 'net' and everything else is an argument. This works under Cygwin /bin/bash just fine.

In Perl, you can call commands like so:
 	system("net use Q: \\\\e04-3000\\foo foo /user:foo");
This fails, with the net command returning Error 67 (resource not found). Unfortunately there's no way it tells me what it THINKS it saw.

This also fails:
system("net", "use Q: \\\\e04-3000\\foo foo /user:foo");

*** This WORKS:
system("net", "use", "Q:", "\\\\e04-3000\\foo", "foo", "/user:foo");
But it's *evil*. 

Since the above works, I try less evil-looking code:
$cmd = "net use Q: \\\\e04-3000\\foo foo /user:foo"
$mountcode = system (split(' ',$cmd));
to simulate the list that worked. This also fails.


I've been executing code like this (all one string) all along under Linux & Perl. I'm assuming Perl's system() on Cygwin executes CMD.EXE as a subshell (this true?) and, well, this is "one of those differences"

Any Thoughts? Thanks.

-Scott




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019