mirror of https://github.com/vitalif/phantomjs
Use fs.write in the example for clarity.
https://code.google.com/p/phantomjs/issues/detail?id=10821.9
parent
04368c6af8
commit
ca27a8eab1
|
@ -13,8 +13,7 @@ else
|
||||||
content += system.args[i] + (if i == system.args.length - 1 then "" else " ")
|
content += system.args[i] + (if i == system.args.length - 1 then "" else " ")
|
||||||
++i
|
++i
|
||||||
try
|
try
|
||||||
f = fs.open(system.args[1], "w")
|
fs.write system.args[1], content, "w"
|
||||||
f.writeLine content
|
|
||||||
catch e
|
catch e
|
||||||
console.log e
|
console.log e
|
||||||
phantom.exit()
|
phantom.exit()
|
||||||
|
|
|
@ -14,10 +14,8 @@ if (system.args.length < 3) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
f = fs.open(system.args[1], "w");
|
fs.write(system.args[1], content, 'w');
|
||||||
f.writeLine(content);
|
} catch(e) {
|
||||||
f.close();
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue