Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exec_replace #658

Merged
merged 1 commit into from
Sep 23, 2023
Merged

Fix exec_replace #658

merged 1 commit into from
Sep 23, 2023

Conversation

MrDenkoV
Copy link
Contributor

@MrDenkoV MrDenkoV commented Sep 8, 2023

Fix #125, Fix #129

@MrDenkoV MrDenkoV requested a review from mkaput as a code owner September 8, 2023 15:16
@maciektr maciektr marked this pull request as draft September 8, 2023 15:41
@MrDenkoV MrDenkoV marked this pull request as ready for review September 12, 2023 08:27
Copy link
Member

@mkaput mkaput left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am amazed that this fixes #129. Can you please properly link #129 to this issue? (you need to write fix #125, fix #129 in issue description)

Let's test this more thoroughly

@maciektr
Copy link
Contributor

maciektr commented Sep 15, 2023

👋
On the topic of our offline conversation about ctrl_c test on windows 🪟 :

The error you have been seeing seems to come from the subcommand spawn.

This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher. (os error 216)

It seems that the script definition used there is just not runnable on windows. (

formatdoc!(
)

After changing the script definition, I was able to run it successfully and ensure it has been killed by ctrl_c.
To test this, I have created a main.rs file in scarb-test-support crate with following content: https://gist.github.com/maciektr/6b6c18a358b5792912bc0d0261ef3ac2
Then I have used this in tests instead.

    let addr = {
        let addr = listener.local_addr().unwrap();
        addr.to_string()
    };

    let mut child = Scarb::new()
        .std()
        .arg("test-support")
        .arg("hang-on-tcp")
        .arg("--address")
        .arg(addr)

May not be the cleanest flow, but imho worth considering.

I have not been able to make this check work though. I do not understand what is the purpose of this.

    match sock.read(&mut [0; 10]) {
        Ok(n) => assert_eq!(n, 0),
        Err(e) => assert_eq!(e.kind(), io::ErrorKind::ConnectionReset),
    }

I know it has been copied from Cargo verbatim. Maybe it is enough for now to only check if the process has been killed? cc @mkaput

@mkaput
Copy link
Member

mkaput commented Sep 19, 2023

I have not been able to make this check work though. I do not understand what is the purpose of this.

    match sock.read(&mut [0; 10]) {
        Ok(n) => assert_eq!(n, 0),
        Err(e) => assert_eq!(e.kind(), io::ErrorKind::ConnectionReset),
    }

I know it has been copied from Cargo verbatim. Maybe it is enough for now to only check if the process has been killed? cc @mkaput

This check tests if the socket either closed successfully without any unread rubbish left in the buffer, or died by the second party being terminated.

It seems that the script definition used there is just not runnable on windows. (

formatdoc!(

)
After changing the script definition, I was able to run it successfully and ensure it has been killed by ctrl_c. To test this, I have created a main.rs file in scarb-test-support crate with following content: https://gist.github.com/maciektr/6b6c18a358b5792912bc0d0261ef3ac2 Then I have used this in tests instead.

    let addr = {
        let addr = listener.local_addr().unwrap();
        addr.to_string()
    };

    let mut child = Scarb::new()
        .std()
        .arg("test-support")
        .arg("hang-on-tcp")
        .arg("--address")
        .arg(addr)

May not be the cleanest flow, but imho worth considering.

I like this! I'd only rather use Command::new(cargo_bin!("scarb-test-support")) instead of Scarb::new().std(), seems more clear.

@MrDenkoV MrDenkoV force-pushed the mrdenkov/exec_replace branch from 82cb6f7 to 52b2a92 Compare September 23, 2023 10:40
@MrDenkoV MrDenkoV added this pull request to the merge queue Sep 23, 2023
Merged via the queue into main with commit cc1711d Sep 23, 2023
@MrDenkoV MrDenkoV deleted the mrdenkov/exec_replace branch September 23, 2023 11:28
github-merge-queue bot pushed a commit that referenced this pull request Feb 3, 2025
Bumps the non-critical group with 4 updates:
[async-trait](https://github.com/dtolnay/async-trait),
[convert_case](https://github.com/rutrum/convert-case),
[petgraph](https://github.com/petgraph/petgraph) and
[syn](https://github.com/dtolnay/syn).

Updates `async-trait` from 0.1.85 to 0.1.86
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/dtolnay/async-trait/releases">async-trait's
releases</a>.</em></p>
<blockquote>
<h2>0.1.86</h2>
<ul>
<li>Documentation improvements</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/dtolnay/async-trait/commit/46a70c0a1fa63201ac6429702ba7d82aa97c3f00"><code>46a70c0</code></a>
Release 0.1.86</li>
<li><a
href="https://github.com/dtolnay/async-trait/commit/0e43f2977b1be4f9447df39ac9a13063a9660689"><code>0e43f29</code></a>
Merge pull request <a
href="https://github.com/dtolnay/async-trait/issues/286">#286</a>
from dtolnay/dyncomp</li>
<li><a
href="https://github.com/dtolnay/async-trait/commit/c49cbcb929cf8be9b22f6990c87c7f06218da6ee"><code>c49cbcb</code></a>
Update 'object safe' -&gt; 'dyn compatible' naming in tests</li>
<li><a
href="https://github.com/dtolnay/async-trait/commit/87316f9058a50e9d1956576cafd25bb1974ab6a8"><code>87316f9</code></a>
Merge pull request <a
href="https://github.com/dtolnay/async-trait/issues/285">#285</a>
from dtolnay/dyncomp</li>
<li><a
href="https://github.com/dtolnay/async-trait/commit/eb69fb324fbe5bc734ead79cb3ea1c6e509dc3a9"><code>eb69fb3</code></a>
Delete section on dyn compatibility of default implementations</li>
<li><a
href="https://github.com/dtolnay/async-trait/commit/ec9665a411c1946585c7e4981bc113c985731e2d"><code>ec9665a</code></a>
Update example error message in docs</li>
<li><a
href="https://github.com/dtolnay/async-trait/commit/f1b4d3cac4a35e9d7f8e12a9eaacd88f638be16c"><code>f1b4d3c</code></a>
Update ui test suite to nightly-2025-02-01</li>
<li><a
href="https://github.com/dtolnay/async-trait/commit/b33a4b21b6534dc0a51c22e4ceb8c15525958088"><code>b33a4b2</code></a>
More precise gitignore patterns</li>
<li><a
href="https://github.com/dtolnay/async-trait/commit/9d09210d3694fcc49b3e3c76355225de0795accb"><code>9d09210</code></a>
Remove **/*.rs.bk from project-specific gitignore</li>
<li><a
href="https://github.com/dtolnay/async-trait/commit/3f11674af6f1bd11aff252a513e8fffb4f550394"><code>3f11674</code></a>
Update ui test suite to nightly-2025-01-23</li>
<li>See full diff in <a
href="https://github.com/dtolnay/async-trait/compare/0.1.85...0.1.86">compare
view</a></li>
</ul>
</details>
<br />

Updates `convert_case` from 0.6.0 to 0.7.1
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/rutrum/convert-case/commits">compare
view</a></li>
</ul>
</details>
<br />

Updates `petgraph` from 0.6.5 to 0.7.1
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/petgraph/petgraph/blob/master/RELEASES.rst">petgraph's
changelog</a>.</em></p>
<blockquote>
<h1>Version 0.7.1 (2025-01-08)</h1>
<ul>
<li>Do not unnecessarily restrict <code>indexmap</code> version
(<code>[#714](https://github.com/petgraph/petgraph/issues/714)</code>_)</li>
<li>Export <code>UndirectedAdaptor</code>
(<code>[#717](https://github.com/petgraph/petgraph/issues/717)</code>_)</li>
</ul>
<p>..
_<code>[#714](https://github.com/petgraph/petgraph/issues/714)</code>:
<a
href="https://github.com/petgraph/petgraph/pull/714">petgraph/petgraph#714</a>
..
_<code>[#717](https://github.com/petgraph/petgraph/issues/717)</code>:
<a
href="https://github.com/petgraph/petgraph/pull/717">petgraph/petgraph#717</a></p>
<h1>Version 0.7.0 (2024-12-31)</h1>
<ul>
<li>Re-released version 0.6.6 with the correct version number, as it
included a major update to an exposed crate
(<code>[#664](https://github.com/petgraph/petgraph/issues/664)</code>_).</li>
</ul>
<h1>Version 0.6.6 (2024-12-31 - yanked)</h1>
<ul>
<li>Add graph6 format encoder and decoder
(<code>[#658](https://github.com/petgraph/petgraph/issues/658)</code>_)</li>
<li>Dynamic Topological Sort algorithm support
(<code>[#675](https://github.com/petgraph/petgraph/issues/675)</code>_)</li>
<li>Add <code>UndirectedAdaptor</code>
(<code>[#695](https://github.com/petgraph/petgraph/issues/695)</code>_)</li>
<li>Add <code>LowerHex</code> and <code>UpperHex</code> implementations
for <code>Dot</code>
(<code>[#687](https://github.com/petgraph/petgraph/issues/687)</code>_)</li>
<li>Make <code>serde</code> support more complete
(<code>[#550](https://github.com/petgraph/petgraph/issues/550)</code>_)</li>
<li>Process multiple edges in the Floyd-Warshall implementation
(<code>[#685](https://github.com/petgraph/petgraph/issues/685)</code>_)</li>
<li>Update <code>fixedbitset</code> to 0.5.7
(<code>[#664](https://github.com/petgraph/petgraph/issues/664)</code>_)</li>
<li>Fix <code>immediately_dominated_by</code> function called on root of
graph returns root itself
(<code>[#670](https://github.com/petgraph/petgraph/issues/670)</code>_)</li>
<li>Fix adjacency matrix for <code>Csr</code> and <code>List</code>
(<code>[#648](https://github.com/petgraph/petgraph/issues/648)</code>_)</li>
<li>Fix clippy warnings
(<code>[#701](https://github.com/petgraph/petgraph/issues/701)</code>_)</li>
<li>Add performance note to the <code>all_simple_paths</code> function
documentation
(<code>[#693](https://github.com/petgraph/petgraph/issues/693)</code>_)</li>
</ul>
<p>..
_<code>[#658](https://github.com/petgraph/petgraph/issues/658)</code>:
<a
href="https://github.com/petgraph/petgraph/pull/658">petgraph/petgraph#658</a>
..
_<code>[#675](https://github.com/petgraph/petgraph/issues/675)</code>:
<a
href="https://github.com/petgraph/petgraph/pull/675">petgraph/petgraph#675</a>
..
_<code>[#695](https://github.com/petgraph/petgraph/issues/695)</code>:
<a
href="https://github.com/petgraph/petgraph/pull/695">petgraph/petgraph#695</a>
..
_<code>[#687](https://github.com/petgraph/petgraph/issues/687)</code>:
<a
href="https://github.com/petgraph/petgraph/pull/687">petgraph/petgraph#687</a>
..
_<code>[#550](https://github.com/petgraph/petgraph/issues/550)</code>:
<a
href="https://github.com/petgraph/petgraph/pull/550">petgraph/petgraph#550</a>
..
_<code>[#685](https://github.com/petgraph/petgraph/issues/685)</code>:
<a
href="https://github.com/petgraph/petgraph/pull/685">petgraph/petgraph#685</a>
..
_<code>[#664](https://github.com/petgraph/petgraph/issues/664)</code>:
<a
href="https://github.com/petgraph/petgraph/pull/664">petgraph/petgraph#664</a>
..
_<code>[#670](https://github.com/petgraph/petgraph/issues/670)</code>:
<a
href="https://github.com/petgraph/petgraph/pull/670">petgraph/petgraph#670</a>
..
_<code>[#648](https://github.com/petgraph/petgraph/issues/648)</code>:
<a
href="https://github.com/petgraph/petgraph/pull/648">petgraph/petgraph#648</a>
..
_<code>[#701](https://github.com/petgraph/petgraph/issues/701)</code>:
<a
href="https://github.com/petgraph/petgraph/pull/701">petgraph/petgraph#701</a>
..
_<code>[#693](https://github.com/petgraph/petgraph/issues/693)</code>:
<a
href="https://github.com/petgraph/petgraph/pull/693">petgraph/petgraph#693</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/petgraph/petgraph/commit/2765d2a55044a35a20d95c50a2f318fbc3bb85f4"><code>2765d2a</code></a>
Release 0.7.1 (<a
href="https://github.com/petgraph/petgraph/issues/722">#722</a>)</li>
<li><a
href="https://github.com/petgraph/petgraph/commit/d341db9d18582cfcffebf320896947e55ecba09c"><code>d341db9</code></a>
ci: downgrade hashbrown rather than limiting indexmap (<a
href="https://github.com/petgraph/petgraph/issues/714">#714</a>)</li>
<li><a
href="https://github.com/petgraph/petgraph/commit/73c64b629f38dc8b0a8edc7550f16a662ed05c25"><code>73c64b6</code></a>
Make UndirectedAdaptor &amp; inner G pub (<a
href="https://github.com/petgraph/petgraph/issues/717">#717</a>)</li>
<li><a
href="https://github.com/petgraph/petgraph/commit/d057429081bc02812d3605d1e7159f0e73361e51"><code>d057429</code></a>
Release <code>0.7.0</code> (<a
href="https://github.com/petgraph/petgraph/issues/713">#713</a>)</li>
<li><a
href="https://github.com/petgraph/petgraph/commit/13ebd7d2ddd4a1ac07a33606c0d4f82d342e5fa6"><code>13ebd7d</code></a>
Release <code>0.6.6</code> (<a
href="https://github.com/petgraph/petgraph/issues/706">#706</a>)</li>
<li><a
href="https://github.com/petgraph/petgraph/commit/159341e4af2a1292d8a1da428d64784e2dfc8ae5"><code>159341e</code></a>
Implement DSatur graph coloring algorithm</li>
<li><a
href="https://github.com/petgraph/petgraph/commit/7fa3aac97168de7fca54644a5b45c464d5245535"><code>7fa3aac</code></a>
fix: adjacency matrix for csr and adjacency list (<a
href="https://github.com/petgraph/petgraph/issues/648">#648</a>)</li>
<li><a
href="https://github.com/petgraph/petgraph/commit/9fda6bbe2e52663d03317083d2623faa4f0d4cd4"><code>9fda6bb</code></a>
Update gitignore with possible editor extensions to ensure they do not
occur ...</li>
<li><a
href="https://github.com/petgraph/petgraph/commit/9b5837e395c342e9cb2e5a2b3870fa7ee6650ef4"><code>9b5837e</code></a>
Allow clippy::needless_range_loop in benches</li>
<li><a
href="https://github.com/petgraph/petgraph/commit/ad9f83c2ae237ba6f5832a19f01ef8c3ae14dd19"><code>ad9f83c</code></a>
Process warnings in 'test' target</li>
<li>Additional commits viewable in <a
href="https://github.com/petgraph/petgraph/compare/[email protected]@v0.7.1">compare
view</a></li>
</ul>
</details>
<br />

Updates `syn` from 2.0.96 to 2.0.98
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/dtolnay/syn/releases">syn's
releases</a>.</em></p>
<blockquote>
<h2>2.0.98</h2>
<ul>
<li>Allow lifetimes in function pointer return values in
<code>ParseStream::call</code> and <code>Punctuated</code> parsers (<a
href="https://github.com/dtolnay/syn/issues/1847">#1847</a>)</li>
</ul>
<h2>2.0.97</h2>
<ul>
<li>Documentation improvements</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/dtolnay/syn/commit/71f3808e0dba5a9dc8255ecc1c63a5da8b61b3e4"><code>71f3808</code></a>
Release 2.0.98</li>
<li><a
href="https://github.com/dtolnay/syn/commit/f0c57eeba731463620cbeda70306934617e5c86d"><code>f0c57ee</code></a>
Merge pull request <a
href="https://github.com/dtolnay/syn/issues/1847">#1847</a>
from dtolnay/lifetimes</li>
<li><a
href="https://github.com/dtolnay/syn/commit/4307f646697e9d9114349f638f0fc73724c0af7c"><code>4307f64</code></a>
Allow lifetimes in function pointer return values</li>
<li><a
href="https://github.com/dtolnay/syn/commit/d15bdea0be9215accd38ce6a42fae1f50f971594"><code>d15bdea</code></a>
Release 2.0.97</li>
<li><a
href="https://github.com/dtolnay/syn/commit/bf672a993dbbc8797f63536ea26ad27492191005"><code>bf672a9</code></a>
Merge pull request <a
href="https://github.com/dtolnay/syn/issues/1846">#1846</a>
from dtolnay/surroundcfg</li>
<li><a
href="https://github.com/dtolnay/syn/commit/f0ee7e92241b29b6350707589b47bd44018b802a"><code>f0ee7e9</code></a>
Fix missing doc cfg on &lt;$Delimiter&gt;::surround</li>
<li><a
href="https://github.com/dtolnay/syn/commit/e0e40cfe1b419289b1c97975704f6904cd87ccbd"><code>e0e40cf</code></a>
Resolve unnecessary_semicolon pedantic clippy lint</li>
<li><a
href="https://github.com/dtolnay/syn/commit/6ebd966cf963272608afa01380486349dac6dccd"><code>6ebd966</code></a>
Resolve sliced_string_as_bytes clippy lint</li>
<li><a
href="https://github.com/dtolnay/syn/commit/a09b650a5f69ea43c2d32f5c5dc179b634eeb3c6"><code>a09b650</code></a>
More precise gitignore patterns</li>
<li><a
href="https://github.com/dtolnay/syn/commit/42601b92eb9c4d263683a9c7aa192a4f44683c6f"><code>42601b9</code></a>
Resolve needless_continue pedantic clippy lint</li>
<li>Additional commits viewable in <a
href="https://github.com/dtolnay/syn/compare/2.0.96...2.0.98">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix subcommand CTRL+C test Properly implement scarb::process::exec_replace
3 participants