public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Derek Pagel <Derek.Pagel@infor.com>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Cc: Takashi Yano <takashi.yano@nifty.ne.jp>
Subject: RE: Cygwin commands are intermittently hanging on Windows
Date: Tue, 8 Nov 2022 13:25:05 +0000	[thread overview]
Message-ID: <CH2PR02MB6024059985EA304DB4C442D5E53F9@CH2PR02MB6024.namprd02.prod.outlook.com> (raw)
In-Reply-To: <20221108092420.7e52f3be24171e27b0215a52@nifty.ne.jp>

The script was written using Strawberry Perl with Cygwin in the %PATH% variable. Then the script makes system calls using that Cygwin.


On Mon, 7 Nov 2022 22:06:46 +0000
Derek Pagel wrote:
> I've printed the script below for reference:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> use strict;
> use Cwd;
> 
> my $TESTDIR = getcwd() . "\\test<file://test>"; my $MKDIRCMD = "mkdir 
> test"; my $TOUCHCMD = 'touch test.txt'; my $CPCMD = 'cp test.txt 
> test2.txt'; my $MVCMD = "mv test.txt " . $TESTDIR . 
> "\\test.txt<file://test.txt>"; my $WHICHCMD = 'which explorer.exe'; my 
> $RMCMD = "rm " . $TESTDIR . "\\test.txt 
> test2.txt<file://test.txt%20test2.txt>";
> my $count = 0;
> my $fh;
> my $LOG = open $fh, '>', 'cygwinTest.log';
> 
> if ( ! -e $TESTDIR ) {
>                 runCMD($MKDIRCMD, 0);
> }
> 
> while ($count < 10000) {
>                 print "Loop $count:\n";
>                 runCMD($TOUCHCMD, $count);
>                 runCMD($CPCMD, $count);
>                 runCMD($MVCMD, $count);
>                 runCMD($WHICHCMD, $count);
>                 runCMD($RMCMD, $count);
>                 $count++;
> }
> 
> sub runCMD {
>                 my $CMD = $_[0];
>                 my $COUNT = $_[1];
>                 my $retCode;
>                 my $startTime;
>                 my $endTime;
>                 my $totalTime;
> 
>                 $startTime = time();
>                 $CMD = "C:\\Windows\\system32\\cmd.exe /c $CMD";
>                 $retCode = system($CMD);
>                 $endTime = time();
>                 $totalTime = $endTime - $startTime;
>                 if ($totalTime > 1 ) {
>                                 print $fh "Loop #$COUNT:\n";
>                                 if ($retCode == 0) {
>                                                 print $fh "It took $totalTime seconds to run [$CMD]\n";
>                                 } else {
>                                                 print $fh "It took $totalTime seconds to unsuccesfully run [$CMD]\n";
>                                 }
>                 }
> }
> 
> close $fh;
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Which script language do you use for this script?
It looks like perl script, however, cygwin perl cannot run this script.

--
Takashi Yano <takashi.yano@nifty.ne.jp>


  reply	other threads:[~2022-11-08 13:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 22:06 Derek Pagel
2022-11-08  0:24 ` Takashi Yano
2022-11-08 13:25   ` Derek Pagel [this message]
2022-11-08 15:41     ` Takashi Yano
2022-11-08 16:00       ` Derek Pagel
2022-11-08 16:50         ` Takashi Yano
2022-11-08 17:17           ` Derek Pagel
2022-11-08 17:24             ` Takashi Yano
2022-11-08 18:11               ` Derek Pagel
2022-11-22 13:23                 ` Derek Pagel
2022-11-16 17:19               ` Derek Pagel
2022-11-25 21:54                 ` Brian Inglis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CH2PR02MB6024059985EA304DB4C442D5E53F9@CH2PR02MB6024.namprd02.prod.outlook.com \
    --to=derek.pagel@infor.com \
    --cc=cygwin@cygwin.com \
    --cc=takashi.yano@nifty.ne.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).