Skip to content

Commit

Permalink
v7.5.1
Browse files Browse the repository at this point in the history
### 更新点
- `System.execBatchScript` の標準エラーが正しく取得できていなかった問題を修正
  • Loading branch information
natade-jp committed May 29, 2021
1 parent b58dea3 commit 23b88c9
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 41 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# History

## SenkoWSH v7.5.1
### 更新点
- `System.execBatchScript` の標準エラーが正しく取得できていなかった問題を修正

## SenkoWSH v7.5.0
### 更新点
- `System.execBatchScript` の実行結果を単純な文字列から、より詳細なデータ `SystemExecResult` で返すように変更
Expand Down
Binary file modified build/SenkoWSH.js
Binary file not shown.
20 changes: 10 additions & 10 deletions docs/class/src/senko/System.js~System.html
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ <h3 data-ice="anchor" id="static-method-callWindowsAPI">
<span class="right-info">


<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber486">source</a></span></span>
<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber488">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -1241,7 +1241,7 @@ <h3 data-ice="anchor" id="static-method-createByteArrayFromNumberArray">
<span class="right-info">


<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber644">source</a></span></span>
<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber646">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -1324,7 +1324,7 @@ <h3 data-ice="anchor" id="static-method-createMSXMLDOMDocument">
<span class="right-info">


<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber585">source</a></span></span>
<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber587">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -1383,7 +1383,7 @@ <h3 data-ice="anchor" id="static-method-createNumberArrayFromByteArray">
<span class="right-info">


<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber610">source</a></span></span>
<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber612">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -1458,7 +1458,7 @@ <h3 data-ice="anchor" id="static-method-createXMLHttpRequest">
<span class="right-info">


<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber544">source</a></span></span>
<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber546">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -1734,7 +1734,7 @@ <h3 data-ice="anchor" id="static-method-execPowerShell">
<span class="right-info">


<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber445">source</a></span></span>
<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber447">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -2032,7 +2032,7 @@ <h3 data-ice="anchor" id="static-method-getClipBoardText">
<span class="right-info">


<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber514">source</a></span></span>
<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber516">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -2389,7 +2389,7 @@ <h3 data-ice="anchor" id="static-method-isNativeCode">
<span class="right-info">


<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber710">source</a></span></span>
<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber712">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -2802,7 +2802,7 @@ <h3 data-ice="anchor" id="static-method-setClipBoardText">
<span class="right-info">


<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber527">source</a></span></span>
<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber529">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -3027,7 +3027,7 @@ <h3 data-ice="anchor" id="static-method-typeOf">
<span class="right-info">


<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber690">source</a></span></span>
<span data-ice="source"><span><a href="file/src/senko/System.js.html#lineNumber692">source</a></span></span>
</span>
</h3>

Expand Down
16 changes: 9 additions & 7 deletions docs/file/src/senko/System.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,8 @@
// UTF-8 &#x3084; Shift_JIS &#x306F;&#x76F4;&#x63A5;&#x5B9F;&#x884C;&#x3067;&#x304D;&#x306A;&#x3044;&#x306E;&#x3067; chcp &#x7528;&#x306E;&#x30B9;&#x30AF;&#x30EA;&#x30D7;&#x30C8;&#x3092;&#x631F;&#x307E;&#x305B;&#x308B;
const temp_starter = new SFile(temp_folder.getAbsolutePath() + &quot;//&quot; + &quot;start.bat&quot;);
const temp_script = new SFile(temp_folder.getAbsolutePath() + &quot;//&quot; + &quot;script.bat&quot;);
const output_txt = new SFile(temp_folder.getAbsolutePath() + &quot;//&quot; + &quot;output.txt&quot;);
const output_std_txt = new SFile(temp_folder.getAbsolutePath() + &quot;//&quot; + &quot;output_std.txt&quot;);
const output_err_txt = new SFile(temp_folder.getAbsolutePath() + &quot;//&quot; + &quot;output_err.txt&quot;);

/**
* chcp &#x5909;&#x66F4;&#x7528;&#x306E;&#x30B9;&#x30AF;&#x30EA;&#x30D7;&#x30C8;
Expand All @@ -477,7 +478,7 @@
const starter_scrpt = [];
starter_scrpt.push(&quot;chcp &quot; + chcp);
starter_scrpt.push(&quot;@echo off&quot;);
starter_scrpt.push(&quot;call \&quot;&quot; + temp_script + &quot;\&quot; &gt; \&quot;&quot; + output_txt + &quot;\&quot;&quot;);
starter_scrpt.push(&quot;call \&quot;&quot; + temp_script + &quot;\&quot; 1&gt; \&quot;&quot; + output_std_txt + &quot;\&quot; 2&gt; \&quot;&quot; + output_err_txt + &quot;\&quot;&quot;);
starter_scrpt.push(&quot;&quot;);

// &#x9014;&#x4E2D;&#x304B;&#x3089;&#x6587;&#x5B57;&#x30B3;&#x30FC;&#x30C9;&#x304C;&#x5909;&#x308F;&#x308B;&#x3053;&#x3068;&#x3092;&#x60F3;&#x5B9A;&#x3059;&#x308B;&#x305F;&#x3081; BOM &#x3092;&#x4ED8;&#x3051;&#x306A;&#x3044;
Expand All @@ -490,15 +491,16 @@
const command = cmd_base + &quot; \&quot;&quot; + temp_starter + &quot;\&quot;&quot;;

// &#x5B9F;&#x884C;
const ret = System.run(command, System.AppWinStype.Hide, true);
const text = output_txt.isFile() ? (output_txt.readString(icharset).replace(/\r?\n$/, &quot;&quot;)) : &quot;&quot;;
const exit_code = System.run(command, System.AppWinStype.Hide, true);
const out = output_std_txt.isFile() ? (output_std_txt.readString(icharset).replace(/\r?\n$/, &quot;&quot;)) : &quot;&quot;;
const error = output_err_txt.isFile() ? (output_err_txt.readString(icharset).replace(/\r?\n$/, &quot;&quot;)) : &quot;&quot;;
temp_folder.remove();

// &#x30A8;&#x30E9;&#x30FC;&#x30B3;&#x30FC;&#x30C9;&#x304C;&#x3042;&#x308B;&#x5834;&#x5408;&#x306F;&#x3001;error &#x306E;&#x65B9;&#x306B;&#x51FA;&#x529B;&#x7D50;&#x679C;&#x3092;&#x5165;&#x308C;&#x308B;
return {
out : text,
error : ret ? text : &quot;&quot;,
exit_code : ret
out : out,
error : error,
exit_code : exit_code
}
}

Expand Down
24 changes: 12 additions & 12 deletions docs/index.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/source.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@
<td data-ice="filePath"><span><a href="file/src/senko/System.js.html">src/senko/System.js</a></span></td>
<td data-ice="identifier" class="identifiers"><span><a href="class/src/senko/System.js~System.html">System</a></span></td>
<td class="coverage"><span data-ice="coverage">100 %</span><span data-ice="coverageCount" class="coverage-count">35/35</span></td>
<td style="display: none;" data-ice="size">20602 byte</td>
<td style="display: none;" data-ice="lines">743</td>
<td style="display: none;" data-ice="updated">2021-05-07 11:55:19 (UTC)</td>
<td style="display: none;" data-ice="size">20855 byte</td>
<td style="display: none;" data-ice="lines">745</td>
<td style="display: none;" data-ice="updated">2021-05-07 12:03:57 (UTC)</td>
</tr>
<tr data-ice="file">
<td data-ice="filePath"><span><a href="file/src/senko/polyfill/ExtendsArray.js.html">src/senko/polyfill/ExtendsArray.js</a></span></td>
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "senkowsh",
"version": "7.5.0",
"version": "7.5.1",
"description": "JScirpt library for WSH that gathers various functions.",
"author": "natade-jp <natade3@gmail.com> (https://github.com/natade-jp)",
"repository": {
Expand Down
16 changes: 9 additions & 7 deletions src/senko/System.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ export default class System {
// UTF-8 や Shift_JIS は直接実行できないので chcp 用のスクリプトを挟ませる
const temp_starter = new SFile(temp_folder.getAbsolutePath() + "//" + "start.bat");
const temp_script = new SFile(temp_folder.getAbsolutePath() + "//" + "script.bat");
const output_txt = new SFile(temp_folder.getAbsolutePath() + "//" + "output.txt");
const output_std_txt = new SFile(temp_folder.getAbsolutePath() + "//" + "output_std.txt");
const output_err_txt = new SFile(temp_folder.getAbsolutePath() + "//" + "output_err.txt");

/**
* chcp 変更用のスクリプト
Expand All @@ -410,7 +411,7 @@ export default class System {
const starter_scrpt = [];
starter_scrpt.push("chcp " + chcp);
starter_scrpt.push("@echo off");
starter_scrpt.push("call \"" + temp_script + "\" > \"" + output_txt + "\"");
starter_scrpt.push("call \"" + temp_script + "\" 1> \"" + output_std_txt + "\" 2> \"" + output_err_txt + "\"");
starter_scrpt.push("");

// 途中から文字コードが変わることを想定するため BOM を付けない
Expand All @@ -423,15 +424,16 @@ export default class System {
const command = cmd_base + " \"" + temp_starter + "\"";

// 実行
const ret = System.run(command, System.AppWinStype.Hide, true);
const text = output_txt.isFile() ? (output_txt.readString(icharset).replace(/\r?\n$/, "")) : "";
const exit_code = System.run(command, System.AppWinStype.Hide, true);
const out = output_std_txt.isFile() ? (output_std_txt.readString(icharset).replace(/\r?\n$/, "")) : "";
const error = output_err_txt.isFile() ? (output_err_txt.readString(icharset).replace(/\r?\n$/, "")) : "";
temp_folder.remove();

// エラーコードがある場合は、error の方に出力結果を入れる
return {
out : text,
error : ret ? text : "",
exit_code : ret
out : out,
error : error,
exit_code : exit_code
}
}

Expand Down

0 comments on commit 23b88c9

Please sign in to comment.