Hi Mike,
I'm not sure if this is what you need, try:
#$error.clear()
[void]$error.add("Your commit exceeds the maximum size allowed by this server.")
write-host "------------------------" -foregroundColor red -backgroundColor
black
write-host -object $error[0] -fore red -back black
write-host "------------------------" -f red -b black
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog:
http://blogs.microsoft.co.il/blogs/scriptfanatic Quote:
> I'm looking for a way to write to STDERR. The only method I've found
> so far is write-error, but PowerShell likes to add "useful"
> information like script name, arguments, etc. How can this be done?
>
> To elaborate, I'm building a hook for subversion which will deny
> anyone from committing too much data at one time. In order to return
> an error message to the user, the error needs to be written to STDERR.
> AFAIK the only way to do this is with write-error.
>
> So currently, the user gets an error back like this (hyphens mine):
> ----------------------------------------------------------------------
> C:\svn\repos\myrepo\hooks\pre-commit.ps1 :
> Your commit exceeds the maximum size allowed by this server.
> At line: 1 char: 39
> + c:\svn\repos\myrepo\hooks\pre-commit.ps1 <<<< c:\svn\repos\myrepo
> 3-1
> ----------------------------------------------------------------------
> Instead of simply:
> ----------------------------------------------------------------------
> Your commit exceeds the maximum size allowed by this server.
> ----------------------------------------------------------------------
>
> I've tried using write-warning, but this doesn't go to STDERR.
>
> Mike
>