Giter Club home page Giter Club logo

windosu's People

Contributors

hickford avatar jviotti avatar larvata avatar tehsenaus 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

Watchers

 avatar  avatar  avatar

windosu's Issues

add /d for cd

in windosu-elevate.cmd. use cd /d %DIR% instead of cd %DIR%.

Propagate exit code

Given a failing command:

C:\>type fail.bat
@exit /b 1

C:\>fail.bat

C:\>echo %errorlevel%
1

But...

C:\>sudo fail.bat

C:\>echo %errorlevel%
0

Inquirer list never exits on windosu

I'm having a strange issue when running an inquirer list on windosu. The process never exits.

For example:

// test.js
var inquirer = require('inquirer');

inquirer.prompt([
    {
        type: 'list',
        name: 'foo',
        message: 'Hello',
        choices: [ 'Foo', 'Bar' ] 
    }
], function(answers) {
   console.log(answers.foo);
});

When running the script with sudo, the script runs fine, but the process never exits (the windosu callback never gets called). This behaviour is not reproducible when running the script directly.

I've been trying to debug the issue for hours, but have no idea what could be causing this. I was hoping you could provide more insight about how windosu works and what might be causing inquirer to not run as expected (maybe something along readline?).

update to latest `temp` module

When installing on node v6.3.1, I get this error: npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.

Looks like it's a sub-dependency of the temp module used (see below), and the latest temp (0.8.3) already updated to fix this issue.

Not working in production

Everything runs fine in development but my production version doesn't work. The auth prompt pops up but nothing happens after that.

Tried to get a result with Promise and Callback but nothing seems to be returned.

sudo.exec('sc start "Some Service"').then(r => console.log(r)).catch(e => console.log(e))
or
sudo.exec('sc start "Some Service"', null, (e, r) => console.log(e, r))

Win10 64bit, annyversary

/edit: there seem to be some hanging cmd processes popping up and disappearing again ... eating up my cpu
Hard to debug - switching to windows-elevate for now.

Sharing terminal width with elevated processes

Hi, I'm having some issues running a script that uses inquirer with windosu.

The problem is that within windosu context, inquirer is unable to correctly get the width of the terminal, which is being calculated with cli-width.

I've submitted a PR to inquirer to set a default width of 80 characters which seems to work fine in most cases, however there is a way to make windosu share the correct width with the script it executes:

cli-width (in the latest version, v1.1.0), attempts to read the width from an environment variable (CLI_WIDTH) before going for the default value.

This gives us an opportunity to calculate the width from windosu and pass it to child processes like this:

var cliWidth = require('cli-width');
var child_process = require('child_process');

child_process.spawn('foo', [ 'bar' ], {
    env: {
        CLI_WIDTH: cliWidth()
    }
});

This way, scripts being called with windosu have a way to inherit this value, even if not written in NodeJS.

What do you think?

I'll send a PR for demonstration purposes later today, once I have access to a Windows PC.

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.