Git Product home page Git Product logo

exec-sh's Introduction

  • ๐Ÿ‘‹ Hi, Iโ€™m Aleks (Al) @tsertkov
  • ๐Ÿ‘€ Iโ€™m interested in past and future
  • ๐ŸŒฑ Iโ€™m always learning and improving
  • ๐Ÿ’ž๏ธ Iโ€™m looking to collaborate on anything
  • ๐Ÿ“ซ Say hello!
  • โœ Visit alekswrite.com

exec-sh's People

Contributors

ashokws avatar dependabot[bot] avatar mayank23 avatar nlapshin avatar ramesaliyev avatar tsertkov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

exec-sh's Issues

A 'declare' modifier cannot be used in an already ambient context.

tsc -p tsconfig.json
"typescript": "^4.2.3",
"exec-sh": "^0.3.5"
yarn run v1.22.5
$ tsc -p tsconfig.json
node_modules/exec-sh/types/index.d.ts:6:3 - error TS1038: A 'declare' modifier cannot be used in an already ambient context.

6   declare function execSh (command: string | string[], options?: SpawnOptionsWithoutStdio | boolean, callback?: execShCallback): ChildProcessWithoutNullStreams;
    ~~~~~~~

node_modules/exec-sh/types/index.d.ts:7:3 - error TS1038: A 'declare' modifier cannot be used in an already ambient context.

7   declare function execSh (command: string | string[], callback?: execShCallback): ChildProcessWithoutNullStreams;
    ~~~~~~~

node_modules/exec-sh/types/index.d.ts:8:3 - error TS1038: A 'declare' modifier cannot be used in an already ambient context.

8   declare namespace execSh {
    ~~~~~~~

src/bot/commands/private/administration/exec.administration.command.ts:40:55 - error TS2559: Type 'true' has no properties in common with type 'SpawnOptionsWithoutStdio'.

40       const execCommand = await exec.promise(command, true);
                                                         ~~~~


Found 4 errors.

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Ability to override shell.

When used on windows this library always returns cmd even if run in a /bin/sh compatible shell. Unfortunately, not all scripts can be run in both, for example the syntax ENVVAR=value app. I am in a situation where a library is using this library in its build where it uses such syntax and fails to execute. When I manually change this library to return sh it works properly. It would be convenient if there was a env variable or property I could set to force this into a compatible mode for use in windows where a sh compatible shell is available. While I can change the value of process.platform this may have larger consequences. If this sounds worthwhile I can submit a PR.

Fix failing tests on node v8.4.0

Tests are passing in CI and locally with node 0.10 but are failing under v8.4.0.

$ npm -v
5.4.0
$ node -v
v8.4.0
$ npm test
> [email protected] test /Users/tsertkov/Projects/exec-sh
> npm run cover-test && jshint


> [email protected] cover-test /Users/tsertkov/Projects/exec-sh
> istanbul cover --dir artifacts/coverage _mocha -- --reporter spec



  exec-sh
    module.exports
      โœ“ should export a single function
    #execSh() arguments
      โœ“ should pass command to spawn function
      โœ“ should accept array of commands to run
      โœ“ should accept true as options argument
      โœ“ should merge defaults with options
      โœ“ should accept optional 'callback' parameter
      1) should use 'cmd /C' command prefix on windows
      โœ“ should use 'sh -c' command prefix on *nix
      โœ“ should return spawn() result
      โœ“ should aggregate stdoout and stderr
      โœ“ should catch exceptions thrown by spawn
      โœ“ should return empty stdout and stderr when spawn throws
      โœ“ should run callback with error when shell exit with non-zero code


  12 passing (19ms)
  1 failing

  1) exec-sh #execSh() arguments should use 'cmd /C' command prefix on windows:
     AssertionError [ERR_ASSERTION]: 'sh' === 'cmd'
      at context.<anonymous> (/Users/tsertkov/Projects/exec-sh/test/exec-sh.js:98:14)
      at callFn (/Users/tsertkov/Projects/exec-sh/node_modules/mocha/lib/runnable.js:250:21)
      at Test.Runnable.run (/Users/tsertkov/Projects/exec-sh/node_modules/mocha/lib/runnable.js:243:7)
      at Runner.runTest (/Users/tsertkov/Projects/exec-sh/node_modules/mocha/lib/runner.js:373:10)
      at /Users/tsertkov/Projects/exec-sh/node_modules/mocha/lib/runner.js:451:12
      at next (/Users/tsertkov/Projects/exec-sh/node_modules/mocha/lib/runner.js:298:14)
      at /Users/tsertkov/Projects/exec-sh/node_modules/mocha/lib/runner.js:308:7
      at next (/Users/tsertkov/Projects/exec-sh/node_modules/mocha/lib/runner.js:246:23)
      at /Users/tsertkov/Projects/exec-sh/node_modules/mocha/lib/runner.js:270:7
      at done (/Users/tsertkov/Projects/exec-sh/node_modules/mocha/lib/runnable.js:206:5)
      at callFn (/Users/tsertkov/Projects/exec-sh/node_modules/mocha/lib/runnable.js:261:7)
      at Hook.Runnable.run (/Users/tsertkov/Projects/exec-sh/node_modules/mocha/lib/runnable.js:243:7)
      at next (/Users/tsertkov/Projects/exec-sh/node_modules/mocha/lib/runner.js:258:10)
      at Immediate.<anonymous> (/Users/tsertkov/Projects/exec-sh/node_modules/mocha/lib/runner.js:275:5)
      at runCallback (timers.js:781:20)
      at tryOnImmediate (timers.js:743:5)
      at processImmediate [as _immediateCallback] (timers.js:714:5)
$ npm -v
2.15.1
$ node -v
v.0.10.48
$ npm test

> [email protected] test /Users/tsertkov/Projects/exec-sh
> npm run cover-test && npm run jshint


> [email protected] cover-test /Users/tsertkov/Projects/exec-sh
> istanbul cover --dir artifacts/coverage _mocha -- --reporter spec



  exec-sh
    module.exports
      โœ“ should export a single function
    #execSh() arguments
      โœ“ should pass command to spawn function
      โœ“ should accept array of commands to run
      โœ“ should accept true as options argument
      โœ“ should merge defaults with options
      โœ“ should accept optional 'callback' parameter
      โœ“ should use 'cmd /C' command prefix on windows
      โœ“ should use 'sh -c' command prefix on *nix
      โœ“ should return spawn() result
      โœ“ should aggregate stdoout and stderr
      โœ“ should catch exceptions thrown by spawn
      โœ“ should return empty stdout and stderr when spawn throws
      โœ“ should run callback with error when shell exit with non-zero code


  13 passing (29ms)

Thank you!

I just want to thank you for this great product! 4.5M weekly downloads and still only 31 stars ?! :( Much more attention should be paid to the repository by the users.

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.