[Mono-dev] starting process in Linux environment

2012-02-21 Thread pattex007
Hi

i'm trying to start a proces in linux but it fails.

the problem is the process argument, it doesnt recognize it. 
  Process procNetAdapters = new Process();

ProcessStartInfo startInfo = new ProcessStartInfo(ifconfig);
startInfo.Arguments = | grep 'inet addr:';
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.CreateNoWindow = true;

procNetAdapters.StartInfo = startInfo;
procNetAdapters.Start();
using (StreamReader r = procNetAdapters.StandardOutput)
{
string line;
string removedLine;
while ((line = r.ReadLine()) != null)
{
if (!windowList.Contains(ADAPTER:  + line))
{
windowList.Add(ADAPTER:  + line);
}
}

}

procNetAdapters.Close();

}

--
View this message in context: 
http://mono.1490590.n4.nabble.com/starting-process-in-Linux-environment-tp4406870p4406870.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] starting process in Linux environment

2012-02-21 Thread Robert Jordan

On 21.02.2012 13:36, pattex007 wrote:

Hi

i'm trying to start a proces in linux but it fails.

the problem is the process argument, it doesnt recognize it.
   Process procNetAdapters = new Process();

 ProcessStartInfo startInfo = new ProcessStartInfo(ifconfig);
 startInfo.Arguments = | grep 'inet addr:';



Pipes are a shell feature. You can only use them as arguments
to ProcessStartInfo if the process you're trying to start
is the shell itself:

ProcessStartInfo startInfo = new ProcessStartInfo(/bin/bash);
startInfo.Arguments = -c '| grep \\'inet addr:\\'';
...

Robert

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] starting process in Linux environment

2012-02-21 Thread Robert Jordan

On 21.02.2012 14:39, Robert Jordan wrote:

On 21.02.2012 13:36, pattex007 wrote:

Hi

i'm trying to start a proces in linux but it fails.

the problem is the process argument, it doesnt recognize it.
Process procNetAdapters = new Process();

ProcessStartInfo startInfo = new ProcessStartInfo(ifconfig);
startInfo.Arguments = | grep 'inet addr:';



Pipes are a shell feature. You can only use them as arguments
to ProcessStartInfo if the process you're trying to start
is the shell itself:

ProcessStartInfo startInfo = new ProcessStartInfo(/bin/bash);
startInfo.Arguments = -c '| grep \\'inet addr:\\'';


Correction:

startInfo.Arguments = -c 'ifconfig | grep \\'inet addr:\\'';

Robert

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] starting process in Linux environment

2012-02-21 Thread pattex007
thank you for your answer

   Process procNetAdapters = new Process();

ProcessStartInfo startInfo = new
ProcessStartInfo(/bin/bash);
startInfo.Arguments = -c 'ifconfig | grep \\'inet
addr:\\'';
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.CreateNoWindow = true;

procNetAdapters.StartInfo = startInfo;
procNetAdapters.Start();
file = new System.IO.StreamWriter(@c:\ + setLogName +
.log, true);
   
using (StreamReader r = procNetAdapters.StandardOutput)
{
string line;
   // string removedLine;
while ((line = r.ReadLine()) != null)
{
file.WriteLine(line);

}

}

file.Close();
procNetAdapters.Close();

if i run this i get an error with stacktrace

--
View this message in context: 
http://mono.1490590.n4.nabble.com/starting-process-in-Linux-environment-tp4406870p4407088.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] starting process in Linux environment

2012-02-21 Thread Robert Jordan

On 21.02.2012 14:59, pattex007 wrote:

if i run this i get an error with stacktrace


I like how you kept that stacktrace well hidden from us ;)

Robert

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Image.PropertyItems empty with mono

2012-02-21 Thread ChristianManthey
... would it be better to post this in the Mono-osx mailing list?

Kind regards,
Christian

--
View this message in context: 
http://mono.1490590.n4.nabble.com/Image-PropertyItems-empty-with-mono-tp4397247p4407373.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] starting process in Linux environment

2012-02-21 Thread Gladish, Jacob
I tried that code under 2.4.2.1 and got this exception:

Stacktrace:

  at (wrapper managed-to-native) 
System.Diagnostics.Process.CreateProcess_internal 
(System.Diagnostics.ProcessStartInfo,intptr,intptr,intptr,System.Diagnostics.Process/ProcInfo)
 0x00054
  at (wrapper managed-to-native) 
System.Diagnostics.Process.CreateProcess_internal 
(System.Diagnostics.ProcessStartInfo,intptr,intptr,intptr,System.Diagnostics.Process/ProcInfo)
 0x
  at System.Diagnostics.Process.Start_noshell 
(System.Diagnostics.ProcessStartInfo,System.Diagnostics.Process) 0x0095f
  at System.Diagnostics.Process.Start_common 
(System.Diagnostics.ProcessStartInfo,System.Diagnostics.Process) 0x000db
  at System.Diagnostics.Process.Start () 0x00047
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start () 
0x
  at showaddrs.Main (string[]) 0x000d7
  at (wrapper runtime-invoke) showaddrs.runtime_invoke_void_object 
(object,intptr,intptr,intptr) 0x

Native stacktrace:

mono(mono_handle_native_sigsegv+0xb0) [0x48c230]
mono(mono_arch_handle_altstack_exception+0xf5) [0x4bbf55]
/lib64/libpthread.so.0 [0x2aacf9ceac00]
mono [0x562266]
mono [0x59048e]
[0x40013594]


Same code under trunk build from a few minutes ago works fine.


 -Original Message-
 From: mono-devel-list-boun...@lists.ximian.com [mailto:mono-devel-list-
 boun...@lists.ximian.com] On Behalf Of Robert Jordan
 Sent: Tuesday, February 21, 2012 10:37 AM
 To: mono-devel-list@lists.ximian.com
 Subject: Re: [Mono-dev] starting process in Linux environment

 On 21.02.2012 14:59, pattex007 wrote:
  if i run this i get an error with stacktrace

 I like how you kept that stacktrace well hidden from us ;)

 Robert

 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list



IMPORTANT: The information contained in this email and/or its attachments is 
confidential. If you are not the intended recipient, please notify the sender 
immediately by reply and immediately delete this message and all its 
attachments. Any review, use, reproduction, disclosure or dissemination of this 
message or any attachment by an unintended recipient is strictly prohibited. 
Neither this message nor any attachment is intended as or should be construed 
as an offer, solicitation or recommendation to buy or sell any security or 
other financial instrument. Neither the sender, his or her employer nor any of 
their respective affiliates makes any warranties as to the completeness or 
accuracy of any of the information contained herein or that this message or any 
of its attachments is free of viruses.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] starting process in Linux environment

2012-02-21 Thread Rodrigo Kumpera
2.4 is ancient and no longer supported.



On Tue, Feb 21, 2012 at 3:44 PM, Gladish, Jacob jacob.glad...@sig.comwrote:

 I tried that code under 2.4.2.1 and got this exception:

 Stacktrace:

  at (wrapper managed-to-native)
 System.Diagnostics.Process.CreateProcess_internal
 (System.Diagnostics.ProcessStartInfo,intptr,intptr,intptr,System.Diagnostics.Process/ProcInfo)
 0x00054
  at (wrapper managed-to-native)
 System.Diagnostics.Process.CreateProcess_internal
 (System.Diagnostics.ProcessStartInfo,intptr,intptr,intptr,System.Diagnostics.Process/ProcInfo)
 0x
  at System.Diagnostics.Process.Start_noshell
 (System.Diagnostics.ProcessStartInfo,System.Diagnostics.Process) 0x0095f
  at System.Diagnostics.Process.Start_common
 (System.Diagnostics.ProcessStartInfo,System.Diagnostics.Process) 0x000db
  at System.Diagnostics.Process.Start () 0x00047
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start
 () 0x
  at showaddrs.Main (string[]) 0x000d7
  at (wrapper runtime-invoke) showaddrs.runtime_invoke_void_object
 (object,intptr,intptr,intptr) 0x

 Native stacktrace:

mono(mono_handle_native_sigsegv+0xb0) [0x48c230]
mono(mono_arch_handle_altstack_exception+0xf5) [0x4bbf55]
/lib64/libpthread.so.0 [0x2aacf9ceac00]
mono [0x562266]
mono [0x59048e]
[0x40013594]


 Same code under trunk build from a few minutes ago works fine.


  -Original Message-
  From: mono-devel-list-boun...@lists.ximian.com [mailto:mono-devel-list-
  boun...@lists.ximian.com] On Behalf Of Robert Jordan
  Sent: Tuesday, February 21, 2012 10:37 AM
  To: mono-devel-list@lists.ximian.com
  Subject: Re: [Mono-dev] starting process in Linux environment
 
  On 21.02.2012 14:59, pattex007 wrote:
   if i run this i get an error with stacktrace
 
  I like how you kept that stacktrace well hidden from us ;)
 
  Robert
 
  ___
  Mono-devel-list mailing list
  Mono-devel-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-devel-list

 

 IMPORTANT: The information contained in this email and/or its attachments
 is confidential. If you are not the intended recipient, please notify the
 sender immediately by reply and immediately delete this message and all its
 attachments. Any review, use, reproduction, disclosure or dissemination of
 this message or any attachment by an unintended recipient is strictly
 prohibited. Neither this message nor any attachment is intended as or
 should be construed as an offer, solicitation or recommendation to buy or
 sell any security or other financial instrument. Neither the sender, his or
 her employer nor any of their respective affiliates makes any warranties as
 to the completeness or accuracy of any of the information contained herein
 or that this message or any of its attachments is free of viruses.
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] starting process in Linux environment

2012-02-21 Thread Tom Spink
Okay, in that case can you post the stack trace and error message?

Thanks,
Spink.
On Feb 21, 2012 10:28 PM, ? ? bmwfreak...@hotmail.com wrote:

  hi

 yes true, i forgot that, but i dont think thats the problem. because
 without that processstartinfo,  streamwriter  writes it in the homefolder
 and gives no error.
 --
 Date: Tue, 21 Feb 2012 14:01:47 +
 Subject: Re: [Mono-dev] starting process in Linux environment
 From: tsp...@gmail.com
 To: bmwfreak...@hotmail.com

 Are you on Linux or Windows? You're running a Linux program, but have a
 Windows path in your StreamWriter!
 There's your problem!
 Spink.
 On Feb 21, 2012 1:59 PM, pattex007 bmwfreak...@hotmail.com wrote:

 thank you for your answer

 á Process procNetAdapters = new Process();

 á á á á á á á áProcessStartInfo startInfo = new
 ProcessStartInfo(/bin/bash);
 á á á á á á á ástartInfo.Arguments = -c 'ifconfig | grep \\'inet
 addr:\\'';
 á á á á á á á ástartInfo.UseShellExecute = false;
 á á á á á á á ástartInfo.RedirectStandardOutput = true;
 á á á á á á á ástartInfo.CreateNoWindow = true;

 á á á á á á á áprocNetAdapters.StartInfo = startInfo;
 á á á á á á á áprocNetAdapters.Start();
 á á á á á á á áfile = new System.IO.StreamWriter(@c:\ + setLogName +
 .log, true);

 á á á á á áusing (StreamReader r = procNetAdapters.StandardOutput)
 á á á á á á á á{
 á á á á á á á á á ástring line;
 á á á á á á á á á // string removedLine;
 á á á á á á á á á áwhile ((line = r.ReadLine()) != null)
 á á á á á á á á á á{
 á á á á á á á á á á á áfile.WriteLine(line);

 á á á á á á á á á á}

 á á á á á á á á}

 á á á á á áfile.Close();
 á á á á á áprocNetAdapters.Close();

 if i run this i get an error with stacktrace

 --
 View this message in context:
 http://mono.1490590.n4.nabble.com/starting-process-in-Linux-environment-tp4406870p4407088.html
 Sent from the Mono - Dev mailing list archive at Nabble.com.
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list