tehsenaus / windosu Goto Github PK
View Code? Open in Web Editor NEWSudo for Windows
Sudo for Windows
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.
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.
in windosu-elevate.cmd. use cd /d %DIR%
instead of cd %DIR%
.
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
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
?).
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.
└─┬ [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└─┬ [email protected]
├── [email protected]
└─┬ [email protected]
└── [email protected]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.