You've already forked linux-packaging-mono
Imported Upstream version 6.6.0.89
Former-commit-id: b39a328747c2f3414dc52e009fb6f0aa80ca2492
This commit is contained in:
parent
cf815e07e0
commit
95fdb59ea6
@@ -1 +1 @@
|
||||
16e4366036bbbda6a76e190ccf312d642e560318
|
||||
78673562a9c1ebd8895e1f6d6fca65d9b978c4d7
|
||||
@@ -19,8 +19,9 @@ namespace System.Diagnostics {
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
internal delegate void UserCallBack(String data);
|
||||
|
||||
@@ -58,10 +59,10 @@ namespace System.Diagnostics {
|
||||
|
||||
// Cache the last position scanned in sb when searching for lines.
|
||||
private int currentLinePos;
|
||||
|
||||
#if MONO
|
||||
//users to coordinate between Dispose and BeginReadLine
|
||||
private object syncObject = new Object ();
|
||||
//users to coordinate between Dispose and ReadBuffer
|
||||
private object syncObject = new Object ();
|
||||
private IAsyncResult asyncReadResult = null;
|
||||
#endif
|
||||
|
||||
internal AsyncStreamReader(Process process, Stream stream, UserCallBack callback, Encoding encoding)
|
||||
@@ -115,8 +116,31 @@ namespace System.Diagnostics {
|
||||
lock (syncObject) {
|
||||
#endif
|
||||
if (disposing) {
|
||||
if (stream != null)
|
||||
if (stream != null) {
|
||||
#if MONO
|
||||
if (asyncReadResult != null && !asyncReadResult.IsCompleted) {
|
||||
// Closing underlying stream when having pending async read request in progress is
|
||||
// not portable and racy by design. Try to cancel pending async read before closing stream.
|
||||
// We are still holding lock that will prevent new async read requests to queue up
|
||||
// before we have closed and invalidated the stream.
|
||||
if (stream is FileStream) {
|
||||
SafeHandle tmpStreamHandle = ((FileStream)stream).SafeFileHandle;
|
||||
while (!asyncReadResult.IsCompleted) {
|
||||
MonoIOError error;
|
||||
if (!MonoIO.Cancel (tmpStreamHandle, out error) && error == MonoIOError.ERROR_NOT_SUPPORTED) {
|
||||
// Platform don't support canceling pending IO requests on stream. If an async pending read
|
||||
// is still in flight when closing stream, it could trigger a race condition.
|
||||
break;
|
||||
}
|
||||
|
||||
// Wait for a short time for pending async read to cancel/complete/fail.
|
||||
asyncReadResult.AsyncWaitHandle.WaitOne (200);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
stream.Close();
|
||||
}
|
||||
}
|
||||
if (stream != null) {
|
||||
stream = null;
|
||||
@@ -151,7 +175,11 @@ namespace System.Diagnostics {
|
||||
|
||||
if( sb == null ) {
|
||||
sb = new StringBuilder(DefaultBufferSize);
|
||||
#if MONO
|
||||
asyncReadResult = stream.BeginRead (byteBuffer, 0 , byteBuffer.Length, new AsyncCallback (ReadBuffer), null);
|
||||
#else
|
||||
stream.BeginRead(byteBuffer, 0 , byteBuffer.Length, new AsyncCallback(ReadBuffer), null);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
FlushMessageQueue();
|
||||
@@ -169,12 +197,17 @@ namespace System.Diagnostics {
|
||||
|
||||
try {
|
||||
#if MONO
|
||||
var stream = this.stream;
|
||||
if (stream == null)
|
||||
byteLen = 0;
|
||||
else
|
||||
#endif
|
||||
lock (syncObject) {
|
||||
Debug.Assert (ar.IsCompleted);
|
||||
asyncReadResult = null;
|
||||
if (this.stream == null)
|
||||
byteLen = 0;
|
||||
else
|
||||
byteLen = stream.EndRead (ar);
|
||||
}
|
||||
#else
|
||||
byteLen = stream.EndRead(ar);
|
||||
#endif
|
||||
}
|
||||
catch (IOException ) {
|
||||
// We should ideally consume errors from operations getting cancelled
|
||||
@@ -242,10 +275,10 @@ retry_dispose:
|
||||
byteLen = 0;
|
||||
goto retry_dispose;
|
||||
}
|
||||
#endif
|
||||
stream.BeginRead(byteBuffer, 0 , byteBuffer.Length, new AsyncCallback(ReadBuffer), null);
|
||||
#if MONO
|
||||
asyncReadResult = stream.BeginRead (byteBuffer, 0 , byteBuffer.Length, new AsyncCallback(ReadBuffer), null);
|
||||
}
|
||||
#else
|
||||
stream.BeginRead(byteBuffer, 0 , byteBuffer.Length, new AsyncCallback(ReadBuffer), null);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
e1527546950d4297d8578925461d4b22d6a48737
|
||||
7e5b7402c565fff530d672f65fbdb277fef199e2
|
||||
@@ -20,6 +20,7 @@ namespace System.Diagnostics {
|
||||
using System.IO;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Collections.Specialized;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
@@ -38,7 +39,8 @@ namespace System.Diagnostics {
|
||||
PermissionSet(SecurityAction.LinkDemand, Name="FullTrust"),
|
||||
HostProtection(SharedState=true, SelfAffectingProcessMgmt=true)
|
||||
]
|
||||
public sealed partial class ProcessStartInfo {
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
public sealed class ProcessStartInfo {
|
||||
string fileName;
|
||||
string arguments;
|
||||
string directory;
|
||||
@@ -66,6 +68,8 @@ namespace System.Diagnostics {
|
||||
WeakReference weakParentProcess;
|
||||
internal StringDictionary environmentVariables;
|
||||
|
||||
static readonly string [] empty = new string [0];
|
||||
|
||||
/// <devdoc>
|
||||
/// Default constructor. At least the <see cref='System.Diagnostics.ProcessStartInfo.FileName'/>
|
||||
/// property must be set before starting the process.
|
||||
@@ -95,6 +99,17 @@ namespace System.Diagnostics {
|
||||
this.arguments = arguments;
|
||||
}
|
||||
|
||||
Collection<string> _argumentList;
|
||||
|
||||
public Collection<string> ArgumentList {
|
||||
get {
|
||||
if (_argumentList == null) {
|
||||
_argumentList = new Collection<string>();
|
||||
}
|
||||
return _argumentList;
|
||||
}
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// <para>
|
||||
/// Specifies the verb to use when opening the filename. For example, the "print"
|
||||
@@ -459,5 +474,47 @@ namespace System.Diagnostics {
|
||||
windowStyle = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool HaveEnvVars {
|
||||
get { return (environmentVariables != null); }
|
||||
}
|
||||
|
||||
public Encoding StandardInputEncoding { get; set; }
|
||||
|
||||
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)]
|
||||
public string[] Verbs {
|
||||
get {
|
||||
#if MOBILE
|
||||
return empty;
|
||||
#else
|
||||
switch (System.Environment.OSVersion.Platform) {
|
||||
case (PlatformID)4:
|
||||
case (PlatformID)6:
|
||||
case (PlatformID)128:
|
||||
return empty; // no verb on non-Windows
|
||||
default:
|
||||
string ext = String.IsNullOrEmpty (fileName) ? null : Path.GetExtension (fileName);
|
||||
if (ext == null)
|
||||
return empty;
|
||||
|
||||
RegistryKey rk = null, rk2 = null, rk3 = null;
|
||||
try {
|
||||
rk = Registry.ClassesRoot.OpenSubKey (ext);
|
||||
string k = rk != null ? rk.GetValue (null) as string : null;
|
||||
rk2 = k != null ? Registry.ClassesRoot.OpenSubKey (k) : null;
|
||||
rk3 = rk2 != null ? rk2.OpenSubKey ("shell") : null;
|
||||
return rk3 != null ? rk3.GetSubKeyNames () : null;
|
||||
} finally {
|
||||
if (rk3 != null)
|
||||
rk3.Close ();
|
||||
if (rk2 != null)
|
||||
rk2.Close ();
|
||||
if (rk != null)
|
||||
rk.Close ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user