Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Process] Fix pipes cleaning on Windows#19118

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
romainneutron merged 1 commit intosymfony:2.7fromnicolas-grekas:win-clean
Jun 21, 2016

Conversation

@nicolas-grekas
Copy link
Member

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#19089
LicenseMIT
Doc PR-

@fabpot
Copy link
Member

I'm sure you are working on a unit test to cover this, right?

@nicolas-grekasnicolas-grekasforce-pushed thewin-clean branch 2 times, most recently from9b1b04c toee3d7d7CompareJune 21, 2016 06:25
foreach ($this->filesas$offset =>$file) {
if (false ===$file ||false ===$this->fileHandles[$offset] = @fopen($file,'rb')) {
if (false ===$file ||false ===$h = @fopen($file,'rb')) {
$this->__destruct();
Copy link
Member

Choose a reason for hiding this comment

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

I know this should work but to me it looks wrong to do it this way. Can't we rather move the code from__destruct() in its own method and reuse that then?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

it's just a method, but anyway: changed

@nicolas-grekas
Copy link
MemberAuthor

Status: needs work

@nicolas-grekas
Copy link
MemberAuthor

Status: needs review

}
for ($i =0;; ++$i) {
foreach ($pipesas$pipe =>$name) {
@unlink($file =sprintf('%s\\sf_proc_%02X.%s',$tmpDir,$i,$name));
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't you check whether$this->files[$pipe] is already set, to avoid reopening the same pipe several times in case of a retry when the other one fails ? Or is it done on purpose ?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

it's on purpose: code is simpler, and$i is the name for err & out files for the same process

Copy link
Member

@stofstofJun 21, 2016
edited
Loading

Choose a reason for hiding this comment

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

then, you need to close and unlink files you opened for this iteration in case you move to a retry loop

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I don't think so, for 3 reasons: rare error condition, simpler code, and the file will be reused on the next run of the process

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

ok, fixed as part of other changes to make tests green

@nicolas-grekasnicolas-grekasforce-pushed thewin-clean branch 8 times, most recently from2ccb00d to9ffb895CompareJune 21, 2016 11:21
if (false ===$file ||false ===$this->fileHandles[$offset] = @fopen($file,'rb')) {
thrownewRuntimeException('A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable');
$tmpDir =sys_get_temp_dir();
if (!@fopen($file =$tmpDir.'\\sf_proc_00.check','wb')) {
Copy link
Member

Choose a reason for hiding this comment

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

What if another process is started at the same time?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

wb allows it without any issue

Copy link
Member

Choose a reason for hiding this comment

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

Alright then

@romainneutron
Copy link
Contributor

👍

@romainneutron
Copy link
Contributor

romainneutron commentedJun 21, 2016
edited
Loading

Muchas gracias@nicolas-grekas!

@romainneutronromainneutron merged commitd54cd02 intosymfony:2.7Jun 21, 2016
romainneutron added a commit that referenced this pull requestJun 21, 2016
This PR was merged into the 2.7 branch.Discussion----------[Process] Fix pipes cleaning on Windows| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#19089| License       | MIT| Doc PR        | -Commits-------d54cd02 [Process] Fix pipes cleaning on Windows
@nicolas-grekasnicolas-grekas deleted the win-clean branchJune 21, 2016 13:51
This was referencedJun 30, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@nicolas-grekas@fabpot@romainneutron@stof@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp