Shell

Data
Author:
Posted:Friday, September 04, 2009 06:37PM
BYOND Version:454
Operating System:Windows XP Pro
Web Browser:Firefox 3.5.2
Status
ID:554
Status:Verified

A member of our crack team of bug testers has verified that this issue is reproducible, and has handed it off to the development team for investigation.
Descriptive Problem Summary:
The documentation is off and the example does not compile and when modified to run it does not do the expected results.
Numbered Steps to Reproduce Problem:
Just compile and run this
http://www.byond.com/docs/ref/info.html#/proc/shell
Code Snippet (if applicable) to Reproduce Problem:
mob/verb/dir(Path as text)
  shell("dir [Path] > dir.out")
  usr << file2text("dir.out")


Expected Results:
It to quote
"
This example displays the output of the "dir" command to the user.
"
Actual Results:
It throws an error when you compile it and when you correct it...It still fails... As much as I would love it to work as it is documented...
Does the problem occur:
Every time?
Yes It does.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
I really don't know
Workarounds:
None, Unless I had a way of getting the folder byond is in at run-time.

Login to post a comment.

[Comments] [History]

#3 Chowder:  

Tried it and it works but why is a cmd box left to hang.

Edit:
Im not really sure what /D and /C mean but removing /D solves all of my problems. Thanks for the help

Thursday, September 17, 2009 03:12PM
(Edited on Thursday, September 17, 2009 03:17PM)

#2 Tom:  

This happens because shell() doesn't actually invoke the command shell on windows, so pipes and redirects (which are built-into the shell program) won't work. Instead it directly executes the passed argument. The reason we do things this way is to prevent the flickering of the DOS shell every time shell() is called.

You can workaround this by explicitly calling the DOS shell ("cmd") inside shell():

shell("cmd /D /C dir > dir.out")

Do ("help cmd") inside DOS for more info.

We'll update the reference accordingly. Good find.

Thursday, September 17, 2009 12:11AM

#1 Lummox JR:  

I can confirm this is happening, but I'm not quite sure what's going wrong or why. This will need a little more study.

Tuesday, September 15, 2009 04:07PM