ionic-team / ionic-team/ionic-cli

`ionic cordova` wrapping swallows "Terminate batch job (Y/N)?" prompt, causing e.g. `cordova run` processes to not really stop and cause increasing port numbers to be used

未關閉
#2,916 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
TypeScript
星號
2k
分支
682
PR 合併指標
30 天內沒有已合併 PR

描述

Compare what happens when you hit Ctrl + C when running `ionic cordova run ...` vs. when running `cordova run ...`:

On the pure `cordova` command you get an additional prompt:
```
^CTerminate batch job (Y/N)? y
```

When you immediately run the same command again after killing it, it should just start a server again on the same port, `8000` by default. But with `ionic cordova ...` you get increasing port numbers:

```PS C:\Projects\Ionic Demo Projects\browserTest2> ionic cordova run browser
Running app-scripts build: --platform browser --target cordova
[23:04:40] build dev started ...
...
[23:04:55] build dev finished in 14.75 s
> cordova run browser
startPage = index.html
Static file server running @ http://localhost:8001/index.html
CTRL + C to shut down
200 /index.html (gzip)
...
404 /screen
200 /build/vendor.js (gzip)
[23:05:01] lint finished in 6.07 s
PS C:\Projects\Ionic Demo Projects\browserTest2> ionic cordova run browser
Running app-scripts build: --platform browser --target cordova
[23:05:19] build dev started ...
...
[23:05:34] build dev finished in 14.90 s
> cordova run browser
startPage = index.html
Static file server running @ http://localhost:8002/index.html
CTRL + C to shut down
200 /index.html (gzip)
...
404 /screen
```

vs.

```
PS C:\Projects\Ionic Demo Projects\browserTest2> cordova run browser
startPage = index.html
Static file server running @ http://localhost:8000/index.html
CTRL + C to shut down
200 /index.html (gzip)
...
404 /screen
^CTerminate batch job (Y/N)?
^C
PS C:\Projects\Ionic Demo Projects\browserTest2> cordova run browser
startPage = index.html
Static file server running @ http://localhost:8000/index.html
CTRL + C to shut down
304 /index.html
...
404 /screen
```

That this "Terminate batch job" prompt is important can be deduced from what happens when you first run `ionic cordova run` with increasing port numbers, then `cordova run` once with another +1 port and kill it with the prompt, after that the next run will get the initial port number again:

```
...
PS C:\Projects\Ionic Demo Projects\browserTest2> cordova run browser
startPage = index.html
Static file server running @ http://localhost:8003/index.html
CTRL + C to shut down...
^CTerminate batch job (Y/N)?
^CThe system cannot open the device or file specified.
PS C:\Projects\Ionic Demo Projects\browserTest2> cordova run browser
startPage = index.html
Static file server running @ http://localhost:8000/index.html
CTRL + C to shut down
...
```

PS: Found via StackOverflow question https://stackoverflow.com/q/47737515/252627

貢獻指南

開啟貢獻指南

研究方向

未指定檔案或測試。比較 `ionic cordova run browser` 與 `cordova run browser`,在 Windows 上重現 Ctrl+C 的行為,然後追蹤 Ionic CLI 如何包裝 Cordova 程序。完成標準是處理終止提示,且重複執行時重新使用連接埠 8000,而不是遞增連接埠號。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
typescript
領域
cli
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。