Closed
Bug 421751
Opened 16 years ago
Closed 16 years ago
nsIProcess should not open command consoles when running batch files
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: hello, Assigned: hello)
References
Details
Attachments
(1 file)
748 bytes,
patch
|
dougt
:
review+
mconnor
:
superreview+
damons
:
approval1.9+
|
Details | Diff | Splinter Review |
When nsIProcess is used to run a batch file in Windows a command prompt window will pop up. Depending on how quickly the batch file runs it may only flash on screen for a short time. See the weave forums for more info, e.g.: https://labs.mozilla.com/forum/index.php/topic,574.msg2064.html#msg2064
Assignee | ||
Comment 1•16 years ago
|
||
Thanks to dcamp for finding the flag I needed.
Comment 2•16 years ago
|
||
Comment on attachment 308246 [details] [diff] [review] patch v0 This is fine. It only effects console apps but doesn't work on win9x. But we need a comment why this flag is important. add that, and r=dougt
Attachment #308246 -
Flags: review?(benjamin) → review+
Assignee | ||
Comment 3•16 years ago
|
||
Comment on attachment 308246 [details] [diff] [review] patch v0 Thanks Doug. I'll add this: /* The CREATE_NO_WINDOW flag is important to prevent console * windows from appearing. This makes behavior the same on * all platforms. This won't work on win9x, however. The flag * will not have any effect on non-console applications. */ Requesting superreview from :bs.
Attachment #308246 -
Flags: superreview?(benjamin)
Attachment #308246 -
Flags: approval1.9?
Assignee | ||
Comment 4•16 years ago
|
||
Comment on attachment 308246 [details] [diff] [review] patch v0 Removing accidental a?
Attachment #308246 -
Flags: approval1.9?
Assignee | ||
Updated•16 years ago
|
Attachment #308246 -
Flags: superreview?(benjamin) → superreview?(mconnor)
Comment 5•16 years ago
|
||
Comment on attachment 308246 [details] [diff] [review] patch v0 sr=mconnor
Attachment #308246 -
Flags: superreview?(mconnor) → superreview+
Assignee | ||
Comment 6•16 years ago
|
||
Comment on attachment 308246 [details] [diff] [review] patch v0 Thanks Mike. Requesting a1.9... I'd really like to get this into Fx3, it's super small and low-risk, and will make my life easier in Weave. Let me know if you need any more info for why we want this now rather than wait.
Attachment #308246 -
Flags: approval1.9?
Comment 7•16 years ago
|
||
Comment on attachment 308246 [details] [diff] [review] patch v0 a1.9+=damons
Attachment #308246 -
Flags: approval1.9? → approval1.9+
Assignee | ||
Comment 8•16 years ago
|
||
Committed: /cvsroot/mozilla/xpcom/threads/nsProcessCommon.cpp,v <-- nsProcessCommon.cpp new revision: 1.25; previous revision: 1.24
Comment 9•16 years ago
|
||
this is change to previous behavior. with my extenstion I would like to open command prompt window or see batch output and now it's impossible? ... path = System32+"cmd.exe" var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); file.initWithPath(path); var process = Components.classes["@mozilla.org/process/util;1"] .createInstance(Components.interfaces.nsIProcess); process.init(file); var args = ["/k", "cd", "C:"]; process.run(false, args, args.length); ...
Assignee | ||
Comment 10•16 years ago
|
||
You can use nsILocalFile.launch() to get the window: let f = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); f.initWithPath("C:\\WINDOWS\\system32\\cmd.exe"); f.launch();
Assignee | ||
Updated•16 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Comment 11•16 years ago
|
||
It's not the same. How can you pass parameters with f.launch()?
Assignee | ||
Comment 12•16 years ago
|
||
You could run a batch file with all your parameters.
Comment 13•16 years ago
|
||
I am passing parameters to batch and other tools from FF. With launch it is impossible. Maybe better solution is to expose CREATE_NO_WINDOW flag in nsiProcess interface?!
Assignee | ||
Comment 14•16 years ago
|
||
It's not impossible, just requires an extra batch file: runcmd.bat: start cmd %* mozilla: let file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); file.initWithPath("C:\\path\\to\\runcmd.bat"); let proc = Components.classes["@mozilla.org/process/util;1"] .createInstance(Components.interfaces.nsIProcess) proc.init(file); let args = ["/k", "echo", "hi"]; proc.run(false, args, args.length); Works for me.
Comment 15•15 years ago
|
||
This bug has found its way back into Shiretoko FF 3.5 beta. I reported it as bug 485946: https://bugzilla.mozilla.org/show_bug.cgi?id=485946
You need to log in
before you can comment on or make changes to this bug.
Description
•